package com.bayihouse.model.vo;


import com.bayihouse.model.entity.Unit;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.text.SimpleDateFormat;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UnitVO {
    private Long id;

    /**
     *
     */
    private String name;


    private String detail;

    private String createTime;

    public static UnitVO objToVO(Unit unit) {
        UnitVO unitVO = new UnitVO();
        BeanUtils.copyProperties(unit,unitVO);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        unitVO.setCreateTime(simpleDateFormat.format(unit.getCreateTime()));
        return unitVO;
    }


}
